"use client"; import { gamesNoticeWinApi, GameListRep } from "@/api/home"; import Box from "@/components/Box"; import { Button, Popup } from "antd-mobile"; import { useTranslations } from "next-intl"; import { FC, useEffect, useState } from "react"; import { Autoplay } from "swiper/modules"; import { Swiper, SwiperSlide } from "swiper/react"; import { useRouter } from "@/i18n/routing"; import { getToken } from "@/utils/Cookies"; import { useWalletStore } from "@/stores/useWalletStore"; import useGame from "@/hooks/useGame"; import styles from "@/components/Card/style.module.scss"; interface Props {} const HomePrize: FC = () => { const t = useTranslations("HomePage"); const tt = useTranslations("Game"); const [winImg, setWinImg] = useState([]); const gamesNoticeWinRequest = async () => { gamesNoticeWinApi() .then((res: any) => { if (res.code === 200) setWinImg(res.data || []); }) }; useEffect(() => { gamesNoticeWinRequest() }, []) const [visible, setVisible] = useState(false); const [gameInfo, setGameInfo] = useState({}); const handler = (game: GameListRep) => { setVisible(true); setGameInfo(game) console.log(game) }; const router = useRouter(); const token = getToken(); const wallet = useWalletStore((state) => state.wallet); const { getGameUrl } = useGame(); const playGameHandler = () => { setVisible(true); if (!token) { router.push("/login?redirect=/"); return; } let groupType = 1; if (groupType === 1 && Number(wallet.score) + wallet.point <= 0) { router.push("/deposit"); return; } const params = { id: gameInfo.id + "", mode: groupType!, }; getGameUrl(gameInfo, params); }; return (
{t("prize")}
{winImg.map((prize: any, index: number) => (
handler(prize)}>

{prize.phone ? prize.phone.slice(0,3) + '*****' + prize.phone.slice(-3): ''}

R${prize.amount}

))}
{ setVisible(false); }} onClose={() => { setVisible(false); }} showCloseButton={true} getContainer={() => document.querySelector("#app")!} bodyStyle={{ background: "#1c1c1c" }} >
{gameInfo?.game_name_cn}

{gameInfo?.game_name_cn}

{/**/} {/* {t("demo")}*/} {/**/}
); }; export default HomePrize;